﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text.RegularExpressions;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        String[] userLang;
        if (null == Request.UserLanguages)
        {
            userLang = new String[1];
            userLang[0] = "zh-cn";
        }
        else{
            userLang = Request.UserLanguages;
            if(!File.Exists(MapPath("") + "//language//"+userLang[0]+".js")){
                userLang[0] = "zh-cn";
            }
        }
        lanID.InnerHtml = "<script src='language/"+userLang[0]+".js'></script>";

        string userAgent="";
        if (null != Request.Headers["User-Agent"] )
        {
            userAgent = Request.Headers["User-Agent"].ToString().ToLower();
            LOG.writer("user agent: " + userAgent+";  domain:"+URL.getDomain(Request.Url.ToString())+";  client IP:"+Request.UserHostAddress);
        }

        if(Regex.IsMatch(userAgent, @".*(mobile|noki|wap|wapi|mc21|aur|r380|up\.b|winw|upg1|upsI|upsI|qwap|jigs|java|alca|mits|MOT-|my s|wapj|fetc|alav|wapa|Oper|dopod|symbian).*"))
        {
            LOG.writer("123跳转");
            Response.Redirect("h5.aspx");
        }

    }
}